#include <iterator>
#include <iostream>

#ifndef NUMBER_SOURCE_H
#define NUMBER_SOURCE_H

using namespace std;

template<typename T, typename Distance = ptrdiff_t>
class number_source : public iterator<T, Distance>
{
public:
  friend bool operator==(const number_source<T, Distance>& x, const number_source<T, Distance>& y)
  {
    return (x.bad == y.bad);
  }

  number_source() 
    : value(0), bad(true)
  { }

  number_source(const T& t)
    : value(t), bad(false)
  { }

  number_source<T, Distance>& 
  operator++(int = 0)
  {
    return *this;
  }

  const T& 
  operator*() const
  {
    return value;
  }

private:
  const T& value;
  bool bad;
};

#endif

// Local Variables:
// mode: C++
// End:

